import sys

class Solution(object):
    def maxProfit(self, prices):
        """
        :type prices: List[int]
        :rtype: int
        """
        min = sys.maxsize
        max_price = 0
        for price in prices:
            if price < min:
                min = price
            lose = price - min
            if lose > max_price:
                max_price = lose
        return max_price